package com.rainsoft.center.isec.stream.base;


import com.rainsoft.center.isec.stream.content.entity.AHBaseEntity;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.streaming.api.java.JavaDStream;
import org.apache.spark.streaming.api.java.JavaInputDStream;
import org.apache.spark.streaming.api.java.JavaStreamingContext;

import java.io.Serializable;

/**
 * @Name com.rainsoft.center.isec.stream.controller.IContentDataLoad
 * @Description
 * @Author Elwyn
 * @Version 2017/11/21
 * @Copyright 上海云辰信息科技有限公司
 **/
public interface IBaseDataLoad<T extends AHBaseEntity> extends Serializable{
	JavaStreamingContext getJavaStreamingContext();

	JavaSparkContext getJavaSparkContext();

	JavaInputDStream<ConsumerRecord<String, String>> getJavaInputDStream(JavaStreamingContext javaStreamingContext);

	String generateRowKey(T t);

	SparkConf getSparkConf(String appName);

	void initParam();

	void process();

	void saveToHBase(JavaDStream<T> dStream);

	void saveToHBase(JavaRDD<T> javaRDD);


	int[] saveToOracle(Dataset<Row> rowJavaRDD, String sql);

	void start(JavaStreamingContext javaStreamingContext);
}
